﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TimViec.MP
{
    public partial class backend : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Admin"] == null)
            {
                Response.Redirect("/quan-tri/login.html");
            }
            if (!IsPostBack)
            {
                LoadData();
            }
        }
        public void LoadData()
        {
            if (Session["Admin"] == "administrator")
            {
                lbUser.Text = "Administrator";
            }
            else
            {
                DAL.UserAdmin user = BLL.Admin.UserHelper.Get_User_Email(Session["Admin"].ToString());
                if (user != null)
                {
                    lbUser.Text = user.UserName;
                }
            }
        }
        protected void lbtLogout_Click(object sender, EventArgs e)
        {
            Session.Remove("Admin");
            Response.Redirect("/index.html");
        }
    }
}